<template>
    <div>
      <release-card style="margin-top: 16px" @listenReleaseState="dataGetDynamic(1)"></release-card>
        <social-card :isMy="true" @listenSocialCardState="dataGetDynamic(1)" v-for="(val,index) in rightList" :key="val.postId" :info="val"></social-card>
      <pagination key="container5" style="margin:20px auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
    </div>
</template>
<script>
  import SocialCard from '../../../components/pc/socialContactCard';
  import ReleaseCard from '../../../components/pc/releaseCard';
  import CardContainer from '../../../components/pc/cardContainer';
  import config from '../../../action/config';
  import Pagination from "../../../components/pc/pagination";
  import EmptyCard from "../../../components/pc/emptyCard";

  export default {
    name:'dynamic',
    data(){
      return{
        rightConType:1,
        leftList:[],
        rightList:[],
        pages:1,
      }
    },
    computed:{
      rightConTitle(){
          return '我的动态'
      },
    },
    components:{
      SocialCard,CardContainer,Pagination,ReleaseCard,EmptyCard
    },

    methods:{
      dataGetDynamic(currentPage){
          this.$axios.$get(config.api.get.Post.myList, {
            params: {
              page: currentPage,
              size: 10
            }
          }).then((response) => {
            this.rightList = response.data.dataList;
            this.pages = response.data.totalPage;
          })

      },

      changePage(currentPage){
        //返回页数 请求新的数据

        this.dataGetDynamic(currentPage);
      }


    },
  }
</script>

